package com.android.hq.ganktoutiao.ui.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.hq.ganktoutiao.R;
import com.android.hq.ganktoutiao.data.GanDaTuItem;
import com.android.hq.ganktoutiao.data.GanNewsItem;
import com.android.hq.ganktoutiao.data.GankItem;
import com.android.hq.ganktoutiao.data.GankSearchItem;
import com.android.hq.ganktoutiao.data.NewsSildeItem;
import com.android.hq.ganktoutiao.data.bean.GanAnShunResponse;
import com.android.hq.ganktoutiao.data.bean.GanShiTuRespone;
import com.android.hq.ganktoutiao.data.bean.GanYunGuiZhouRespone;
import com.android.hq.ganktoutiao.data.bean.GankSearchItemBean;
import com.android.hq.ganktoutiao.data.bean.SearchDataResponse;
import com.android.hq.ganktoutiao.network.CallBack;
import com.android.hq.ganktoutiao.network.RequestManager;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by heqiang on 16-10-13.
 */
public class SearchFragment extends BaseFragment {
    @Override
    public void updateData() {
        RequestManager.getInstance().getDayAnShun(new CallBack<GanAnShunResponse>() {
            @Override
            public void onSuccess(GanAnShunResponse anShunResponse) {
                mRefreshLayout.setRefreshing(false);
                ArrayList<GankItem> list  = new ArrayList<GankItem>();
                GanDaTuItem t = anShunResponse.t;
                List<GanDaTuItem> list1 = t.news;
                list.addAll(list1);
                mAdapter.updateData(list);
                updateSuccess(list.isEmpty());
            }

            @Override
            public void onFail() {
                mRefreshLayout.setRefreshing(false);
                updateError();

            }
        });
    }

    @Override
    public void loadMore() {

    }

    @Override
    public boolean isEnablePullRefresh() {
        return true;
    }

    @Override
    public boolean isEnableLoadingMore() {
        return true;
    }

    @Override
    public boolean isEnableRefreshOnViewCreate() {
        return true;
    }
}
